<?php
class JsonHelper extends AppHelper 
{
	var $helpers = array('Html', 'Javascript', 'Form','Ajax','Session','For');
	var $Html = null;
	var $Javascript = null;
	var $Ajax = null;


/**
funcion que muestra logo de agropatria en img
Ejemplo $this->Json->sistemasima();
esta funcion no recibe paramatros
**/
function sistemasima($nombre='',$imagen_src=null){

if(!isset($imagen_src) and $imagen_src==null and $imagen_src==0){
$imagen_src='/img/agropatriahelper.png';
}

$des='2013';
$has=date('Y');

if ($des==$has)
$fech=$des;
else
$fech=$des.' - '.$has;






echo  "<script type='text/javascript'>

Ext.onReady(function() {
   
    var tooltips = [{        
            title: '$nombre',
            id: 'content-anchor-tip',
            target: 'leftCallout',
            anchor: 'left',
            html: null,
            width: 415,
            autoHide: false,
            closable: false,
            contentEl: 'content-tip', // load content from the page
            
        }];
       
    Ext.each(tooltips, function(config) {
        Ext.create('Ext.tip.ToolTip', config);
    });  

});
</script>
        <div style='display:none;'>
            <div id='content-tip' style='overflow:hidden'>
                <div class='x-clear'></div>
<img src='$imagen_src' alt='AGROPATRIA S.A.' border='0' width='200px' height='79px' align='absmiddle' />
                <ul>
                    <li><br /></li>
                    <li>Empresa de Propiedad Social AGROPATRIA S.A.</li>
    
		    <li><br /></li>
                    <li>Copyright © ".$fech." . Todos los derechos reservados.</li>
                </ul>

            </div>
        </div>
";


}






//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function tabs($ayuda='vacio',$parametros=null,$variable=null,$div=null,$iconos=null,$url=null, $formulario=null){
$ayuda_=array(
'titulo'=>'TITULO  //TITULO DE LA VENTANA',
'cerrar'=>'true,false  // BOTON DE CERRAR',
'mover'=>'true,false  // MOVER FUERA LA DE AREA',
'maximizar'=>'true,false  // MAXIMIZAR LA VENTANA',
'icono'=>'grid   // UN ICONO EN "css/tabs/images/icons/grid.png"',
'h'=>'100px o 100%   // TAMANIO DE LA VENTANA EN Height',
'w'=>'100px o 100%   // TAMANIO DE LA VENTANA EN Width',
'minh'=>'100px o 100%   // TAMANIO MAXIMO DE LA VENTANA EN Height',
'minw'=>'100px o 100%   // TAMANIO MAXIMO DE LA VENTANA EN Width',
'maxh'=>'100px o 100%   // TAMANIO MINIMO DE LA VENTANA EN Height',
'maxw'=>'100px o 100%   // TAMANIO MINIMO DE LA VENTANA EN Width',
'depliega1'=>'true,false  // BOTON PARA CONTRAER SI LA VENTANA',
'depliega2'=>'true,false  // BOTON PARA CONTRAER NO LA VENTANA',
);

$ejemplo_='function tabs(null,$array(),$array(),$array(),$array())<br />
           function tabs("ayuda",$parametros,$nombre_tabs,$nombre_div,$nombre_iconos)';


/* $this->Json->tabs(
'ayuda',
array('titulo'=>'REGISTRO DE TARJETA DEL BUEN PRODUCTOR',
'cerrar'=>'true','maximizar'=>'true','mover'=>'true','icono'=>'gogle_palena','w'=>'700px','h'=>'400px','minw'=>'700','minh'=>'400'),
array('Datos Productor','Ubicaci&oacute;n','Datos Productivos','D. Sociopoliticos'),
array('div1','div2','div3','div4','div5'),
array('grid','folder_wrench','gogle','gogle_palena')
);*/



if(isset($parametros) and $parametros!=null or isset($variable) and $variable!=null){

if (isset($parametros['titulo']))$titulo=" title: '".$parametros['titulo']."',";else$titulo="";
if (isset($parametros['cerrar']))$cerrar=" closable: '".$parametros['cerrar']."',";else$cerrar="";
if (isset($parametros['mover']))$mover=" constrain: '".$parametros['mover']."',";else$mover="";
if (isset($parametros['maximizar']))$maximizar=" maximizable: '".$parametros['maximizar']."',";else$maximizar="";
if (isset($parametros['icono']))$icono=" iconCls: '".$parametros['icono']."',";else$icono="";
if (isset($parametros['h']))$h=" height: '".$parametros['h']."',";else$h="";
if (isset($parametros['w']))$w=" width: '".$parametros['w']."',";else$w="";
if (isset($parametros['minh']))$minh=" minHeight: '".$parametros['minh']."',";else$minh="";
if (isset($parametros['minw']))$minw=" minWidth: '".$parametros['minw']."',";else$minw="";
if (isset($parametros['maxh']))$maxh=" maxHeight: '".$parametros['maxh']."',";else$maxh="";
if (isset($parametros['maxw']))$maxw=" maxWidth: '".$parametros['maxw']."',";else$maxw="";
if (isset($parametros['depliega1']))$depliega1=" collapsed: '".$parametros['depliega1']."',";else$depliega1="";
if (isset($parametros['depliega2']))$depliega2=" collapsible: '".$parametros['depliega2']."',";else$depliega2="";



	$parametros="";
         $variable=$variable;
         $div=$div;
         $iconos=$iconos;
         $js_variable = json_encode($variable);
	 $js_iconos = json_encode($iconos);
	 $js_variable = json_encode($variable);

/*	 
$tabs="";
for($i=0; $i<count($iconos); $i++)
{
$class=explode('.',$iconos[$i]);
echo "<br />.".$class[0]." {    background-image:url(css/tabs/images/icons/".$iconos[$i].");}";
$tabs.=".".$class[0]." {    background-image:url(css/tabs/images/icons/".$iconos[$i].");}";
}
*/


$valor="
<style type='text/css'>
.grid {
    background-image:url(css/tabs/images/icons/grid.png);
}
.folder_wrench {
    background-image:url(css/tabs/images/icons/folder_wrench.png);
}
.gogle {
    background-image:url(css/tabs/images/icons/gogle.png);
}
.plugin_add {
    background-image:url(css/tabs/images/icons/plugin_add.png);
}
.gogle_palena {
    background-image:url(css/tabs/images/icons/gogle_palena.png);
}
.book {
    background-image:url(css/tabs/images/icons/book.png);
}
</style>


<script type='text/javascript'>




Ext.onReady(function() {





    // enable the tabTip config below
    Ext.tip.QuickTipManager.init();
    var win = Ext.createWidget('window', {
	".$icono."
	".$maximizar."
        ".$h."
        ".$w."
	".$minh."
	".$minw."
	".$maxh."
	".$maxw."
	".$mover."
	/*isVisible:true,*/
	layoutManagedWidth:2,
        layout: 'fit',
        ".$titulo."
        border: false,
	".$cerrar."
        /*toggle:true,*/
        checkboxToggle: true,
        hideLabel: true,
		


        defaults: {
	
	maximizable: true,
 	/*constrain: false,*/
        /* collapsible: true,*/
            split      : true
           
        },
        
        /*scope: this,*/
       /* handler: this.goToPost,*/
       /* cls: 'preview',*/
        /*autoScroll: true,*/

        /*frame: true,*/
       /* bodyPadding: 5,*/


        items: {
            xtype: 'tabpanel',
           /* activeTab: 0,*/
            itemId: 'tabPanel',
	    	autoScroll: true,
            plugins: [{
                ptype: 'tabscrollermenu',
                maxText  : 1,
                pageSize : 0
            }],
 	    buttons: [{
                    text: 'Cancelar',
                    handler: function() {
                       this.up('window').hide();
                    }
                }, {
                    text: 'Guardar',
                    handler: function() {
                     //  this.up('window').hide();
			EnviaFormulario('div_actualiza_$formulario','$url','$formulario');
	
                    }
                    
                }]



/*,
            items: [{
                title: 'First tab',
          // closable: false,
            autoScroll: true,
	//	  tooltip: 'Posicionamiento sobre el Mapa de Google',
		// contentEl: 'messages'
                html: 'Creating more tabs...'
            }]*/



        }
    });

    win.show();

/*

listeners: {
activate: function(tab){
alert(tab.title + ' was activated.');
}
disabled: true,




*/








    // Add a bunch of tabs dynamically
        tabPanel = win.getComponent('tabPanel');

    Ext.defer(function (num) {
        var i,
            title,
            tabs = [];

               var tabLimit = ". $js_variable .";
               var iconos = ". $js_iconos . ";
               var tabLimit = ". $js_variable . ";
	 

        for (i = 0; i <= ".(count($variable)-1)."; i++) {


            split: true,
            title = tabLimit[i % 12],
            icono = iconos[i % 12];
            
            tabs.push({
                title: title,
/*
		if(tabLimit[i % 12]=='<span id=\"datosproductor\">xxx</span>'){
			disabled: true,
		}
*/

		contentEl: 'messages' + i,
               // html: 'Hi, I am tab ' + tabLimit[i % 12],
                tabTip: title,
		iconCls: icono,
                closable: false
            }

      /*  */);
        }
       tabPanel.add(tabs);
     //  tabPanel.getComponent(0).body.update('Done!');
    }, 100);
});
     
     function cambiartabs(){
         
         //$('.x-tab-center').addClass()
         $('#x-tab-center').addClass('');
         $('#x-tab-center').removeAttr('');
     
}
function alerta(){
alert('xxxxx');
}   



 </script>";
}
else{ 
$valor="
<script type='text/javascript'>
//document.getElementById('messages0').style.display='none';
Ext.onReady(function() {
Ext.MessageBox.alert('ALERTA', 'pase como parametro \'ayuda\' ejemplo funcion(\'ayuda\')', null);
});
</script>
";
}

if($ayuda=='ayuda')
$valor.=$this->ayuda($ayuda_,$ejemplo_);

return $valor;
}


function ayuda($ayuda='vacio',$funcion,$ayuda_=null,$ejemplo_=null){

if($ayuda_!=null){

echo "<div id='div_ayuda'style='display:none;' align='center'><br />
<table border='2' cellpadding='5' cellspacing='5' width='90%' align='center'>
<tr bgcolor='#cccccc'><th>&nbsp;<b>ATRIBUTO</b></th><th>&nbsp;&nbsp;<b>VALOR</b></th></tr>";
foreach ($ayuda_ as $key => $value) {
$value=explode('//',$value);

if(isset($value[1]))$value=$value[0]."<font color='#A4A4A4'>//".$value[1]."</font>";else $value[0]."<font color='#A4A4A4'>//NO DOCUMENTADO</font>";
    echo "<tr bgcolor='#ffffff'><td>&nbsp;$key</td><td>&nbsp;&nbsp;$value</td></tr>";
}
echo "
<tr><td align='center' colspan='2'><br />&nbsp;</td></tr>
<tr bgcolor='#ffffff'><td align='center' colspan='2'>
<font color='#6E6E6E' size='-2'>".$ejemplo_."</font><br />
</td></tr>

</table>
<br />
</div>";

$valor="
<script type='text/javascript'>
Ext.onReady(function() {
    Ext.create('Ext.window.Window', {
//        id : 'mensaje',
        title : 'AYUDA DE LA FUNCTION \"".strtr(strtoupper($funcion),"àèìòùáéíóúçñäëïöü","ÀÈÌÒÙÁÉÍÓÚÇÑÄËÏÖÜ")."\"',
        layout: 'fit',
       width: '50%',
      //  height: '80%',
    	contentEl: 'div_ayuda',
        maximizable: true,
        collapsed: true,
        collapsible: true,
        constrain: false
    }).show();

});

</script>";
$valor.="<script type='text/javascript'>document.getElementById('div_ayuda').style.display='block';</script>";
}
else
{
$valor="";
}
return $valor;

}




















//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


function ayuda2($ayuda_=null,$ejemplo_=null){

if($ayuda_!=null){

echo "<div id='div_ayuda' style='display:none;' align='center'><br />
<table border='2' cellpadding='5' cellspacing='5' width='90%' align='center' bgcolor='#ffffff'>
<tr bgcolor='#cccccc'><th>&nbsp;<b>ATRIBUTO</b></th><th>&nbsp;&nbsp;<b>VALOR</b></th></tr>";
foreach ($ayuda_ as $key => $value) {
$value=explode('//',$value);

if(isset($value[1]))$value=$value[0]."<font color='#A4A4A4'>//".$value[1]."</font>";else $value[0]."<font color='#A4A4A4'>//NO DOCUMENTADO</font>";
    echo "<tr><td>&nbsp;$key</td><td>&nbsp;&nbsp;$value</td></tr>";
}
echo "</table><br />
<br /><table border='0' cellpadding='5' cellspacing='5' width='800px' align='center'>
<tr><td align='center'>
<font color='#6E6E6E'>".$ejemplo_."</font><br />
</td></tr></table>

</div>";

$valor="
<script type='text/javascript'>
Ext.onReady(function() {
    Ext.create('Ext.window.Window', {
//        id : 'mensaje',
        title : 'AYUDA DE FUNCION',
        layout: 'fit',
       width: '50%',
      //  height: '80%',
    	contentEl: 'div_ayuda',
        maximizable: true,
        collapsed: true,
        collapsible: true,
        constrain: false
    }).show();

});

</script>";
$valor.="<script type='text/javascript'>document.getElementById('div_ayuda').style.display='block';</script>";
}
else
{
$valor="";
}
return $valor;

}



/**
Esta funcion crea una ventana json "POR CULMINAR DOCUMENTACION"
$ayuda= ya no se usa y debe ser eliminado lo antes posible
$divlistado= donde hace el llamado
$div= importante este va como nombre del div y del div_2 y debe esta en la vista
$titulo= titulo de la ventana
$url= controlador y vista a donde va el formulario 
$formulario= nombre del formulario a llamar
$tipo= monta botones de guardar y cerrar debo documentar
$animation= animacion de la ventana pero depende de siempre tener el id del div
$width= tamaño en width de la ventana por defecto esta en 80%
$height= tamaño en height de la ventana por defecto esta en 80%
**/
function ventana($ayuda='vacio',$divlistado='vista',$div=null,$titulo='',$url=null,$formulario=null,$tipo=null,$animation=0,$width='80%',$height='80%') {

if($animation==1)$animation="animateTarget: '".$div."',"; else$animation="animateTarget: 'title_tabs_1',";

$titulo=$this->For->mayus('',$titulo);
$div2=$div.'_2';
$valor="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";


$valor.="

<style type='text/css'>
.grid {

    background-image:url(img/iconos/icons/grid.png);
}
.folder_wrench {
    background-image:url(img/iconos/icons/folder_wrench.png);
}

.gogle {
    background-image:url(img/iconos/icons/gogle.png);
}
.plugin_add {
    background-image:url(img/iconos/icons/plugin_add.png);

}
.gogle_palena {
    background-image:url(img/iconos/icons/gogle_palena.png);
}
.book {

    background-image:url(img/iconos/icons/book.png);
}
.cross {
    background-image:url(img/iconos/icons/cross.gif);
}
.accept {
    background-image:url(img/iconos/icons/accept.png);
}



</style>

<script type='text/javascript'>

Ext.onReady(function() {
    var ventana ,
    ventana=Ext.create('Ext.window.Window', {
//        id : 'mensaje',
				title: '$titulo <span id=\'title_filset_ventna\'></span>',
        layout: 'fit',
//	layout: 'border',
  //      width: '80%',
  //      height: '80%',
        width: '$width',
        height: '$height',


        minWidth: '30%',
	minHeight: '40%',
	layoutManagedWidth:2,
    	contentEl: '$div2',
      maximizable: true,
	iconCls: 'grid',
	".$animation."
//	animateTarget: 'menu0',
//  collapsed: true,
//  collapsible: true,
	constrain: true,
	modal: true,
	autoScroll: true,

     

/*  
	toggle:true,
        frame: true,
	resizable: true,

*/
    	   closable: true,
	//closeAction: 'win',
		hideLabel: true,
		floatable: true,
		bodyStyle: 'padding: 5px;background-color:#FFFFFF;',

 		items: [/*{
                    region: 'west',
                    title: 'Menu de Opciones',
                    width: 200,
                    split: true,
                    floatable: false,
		    contentEl: 'vista'
                }*/]

";

if($url!=null and $formulario!=null and $tipo=='productor'){
$valor.="
,
 	    buttons: [{
                   contentEl: '".$formulario."botnesventana1'
                      },
			{
                   contentEl: '".$formulario."botnesventana2'
                      },
			{
                   contentEl: '".$formulario."botnesventana3'
                      },]
";
}
else if($url!=null and $formulario!=null and $tipo=='guardar'){
$valor.="
,
 	    buttons: [/*{
                    text: 'Cancelar',
		    iconCls: 'cross',
                    handler: function() {
                     ventana.hide();
	             ventana=null;
			//  this.up('ventana').hide();
                    }
                }, */{
                    text: 'Guardar',
		    iconCls: 'accept',


                    handler: function() {
    		             //  this.up('window').hide();
											EnviaFormulario('".$divlistado."','".$url."','".$formulario."');
	
                    }
                    
                }]
";
}




$valor.="




    });
ventana.show();

});

</script>";

$valor.="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";


echo $valor;
}

function loading($tipo='cargando'){


if($tipo=='cargando'){
 echo"

<div id='cargando' style='display:none;
position: absolute; width: 100%; height: 100%;
z-index: 400000;
'>
<table border='0' cellpadding='15' cellspacing='15' width='50%' height='90%' align='center' style='border:10;' valign='center'>
<tr>
<td>
</td>
<td width='500px' height='500px' align='center'>
<div style='width: 240px; height: 80px;
background-color: #CED9E7;
border-radius: 5px 5px 5px 5px;
border: 1px double rgb(100, 100, 100);
border-radius:10px;
padding: 4px;
box-shadow: 2px 2px 2px #888888;
'>
<table border='0' cellpadding='15' cellspacing='15' width='100%' height='100%' align='center' valign='center'>
<tr>
<td width='80px' align='center'>
<!--<img src='../img/guardar/download.gif' border='0' />-->
<img src='../img/guardar/loading.gif' border='0' width='60px' height='60px'/>
</td>
<td width='160px' height='70px' align='center'>
<font style='color:#fff;font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 1.5em;'>
Cangando...
</font>
</td>
</tr>
</table>
</div>	
</td>
<td>
</td>
</tr>
</table>
</div>	
";


}
else if($tipo=='guardando'){

echo "

<div id='guardando' style='display:none;
position: absolute; width: 100%; height: 100%;
z-index: 400000;
background-color: rgba(0, 0, 255, 0.1);
color: #fff; padding: 15px;
'>
<table border='0' cellpadding='15' cellspacing='15' width='50%' height='90%' align='center' style='border:10;' valign='center'>
<tr>
<td>
</td>
<td width='500px' height='500px' align='center'>
<div style='width: 240px; height: 80px;
background-color: #CED9E7;
border-radius: 5px 5px 5px 5px;
border: 1px double rgb(100, 100, 100);
border-radius:10px;
padding: 4px;
box-shadow: 2px 2px 2px #888888;
'>
<table border='0' cellpadding='15' cellspacing='15' width='100%' height='100%' align='center' valign='center'>
<tr>
<td width='80px' align='center'>
<img src='../img/guardar/download.gif' border='0' width='40px' height='60px'/>
<!--<img src='../img/guardar/loading.gif' border='0' width='60px' height='60px'/>-->
</td>
<td width='160px' height='70px' align='center'>
<font style='color:#fff;font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 1.5em;'>
Guardando...
</font>
</td>
</tr>
</table>
</div>	
</td>
<td>
</td>
</tr>
</table>
</div>	

";



}



}


function listado(){

?>

        <style type="text/css">
            .x-panel-mc {
                font-size: 12px;
                line-height: 18px;
            }
        </style> <div id="binding-example"></div>


<script type='text/javascript'>



Ext.require([
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.panel.*',
    'Ext.layout.container.Border'
]);
Ext.Loader.onReady(function() {
    Ext.define('Book',{
        extend: 'Ext.data.Model',
        fields: [
            // set up the fields mapping into the xml doc
            // The first needs mapping, the others are very basic
            {name: 'Author', mapping: 'ItemAttributes > Author'},
            'Title',
            'Manufacturer',
            'ProductGroup',
            'DetailPageURL'
        ]
    });


    Ext.define('App.BookStore', {
        extend: 'Ext.data.Store',
        constructor: function(config) {
            config = config || {};

            config.model = 'Book';
            config.proxy = {
                type: 'ajax',
                url: 'sheldon.xml',
                reader: Ext.create('Ext.data.reader.Xml', {
                    // records will have an "Item" tag
                    record: 'Item',
                    id: 'ASIN',
                    totalRecords: '@total'
                })
            };

            // call the superclass's constructor
            this.callParent([config]);
        }
    });



    Ext.define('App.BookGrid', {
        extend: 'Ext.grid.Panel',


        alias: 'widget.bookgrid',

        initComponent : function() {
            // Pass in a column model definition
            // Note that the DetailPageURL was defined in the record definition but is not used
            // here. That is okay.
            this.columns = [
                {text: "Author", width: 120, dataIndex: 'Author', sortable: true},
                {text: "Title", flex: 1, dataIndex: 'Title', sortable: true},
                {text: "Manufacturer", width: 115, dataIndex: 'Manufacturer', sortable: true},
                {text: "Product Group", width: 100, dataIndex: 'ProductGroup', sortable: true}
            ];
            // Note the use of a storeId, this will register thisStore
            // with the StoreManager and allow us to retrieve it very easily.
            this.store = new App.BookStore({
                storeId: 'gridBookStore',
                url: 'sheldon.xml'
            });
            // finally call the superclasses implementation
            this.callParent();
        }
    });


    /**
     * App.BookDetail
     * @extends Ext.Panel
     * This is a specialized Panel which is used to show information about
     * a book.
     *
     * This demonstrates adding 2 custom properties (tplMarkup and
     * startingMarkup) to the class. It also overrides the initComponent
     * method and adds a new method called updateDetail.
     *
     * The class will be registered with an xtype of 'bookdetail'
     */
    Ext.define('App.BookDetail', {
        extend: 'Ext.Panel',
        // register the App.BookDetail class with an xtype of bookdetail
        alias: 'widget.bookdetail',
        // add tplMarkup as a new property
        tplMarkup: [
            'Title: <a href="{DetailPageURL}" target="_blank">{Title}</a><br>',
            'Author: {Author}<br>',
            'Manufacturer: {Manufacturer}<br>',
            'Product Group: {ProductGroup}<br>'
        ],
        // startingMarup as a new property
        startingMarkup: 'Please select a book to see additional details',

        bodyPadding: 7,
        // override initComponent to create and compile the template
        // apply styles to the body of the panel and initialize
        // html to startingMarkup
        initComponent: function() {
            this.tpl = Ext.create('Ext.Template', this.tplMarkup);
            this.html = this.startingMarkup;

            this.bodyStyle = {
                background: '#ffffff'
            };
            // call the superclass's initComponent implementation
            this.callParent();
        },
        // add a method which updates the details
        updateDetail: function(data) {
            this.tpl.overwrite(this.body, data);
        }
    });


    /**
     * App.BookMasterDetail
     * @extends Ext.Panel
     *
     * This is a specialized panel which is composed of both a bookgrid
     * and a bookdetail panel. It provides the glue between the two
     * components to allow them to communicate. You could consider this
     * the actual application.
     *
     */
    Ext.define('App.BookMasterDetail', {
        extend: 'Ext.Panel',
        alias: 'widget.bookmasterdetail',

        frame: true,
        title: 'Book List',
        width: 540,
        height: 400,
        layout: 'border',

        // override initComponent
        initComponent: function() {
            this.items = [{
                xtype: 'bookgrid',
                itemId: 'gridPanel',
                region: 'north',
                height: 210,
                split: true
            },{
                xtype: 'bookdetail',

                itemId: 'detailPanel',
                region: 'center'
            }];
            // call the superclass's initComponent implementation
            this.callParent();
        },
        // override initEvents
        initEvents: function() {
            // call the superclass's initEvents implementation
            this.callParent();

            // now add application specific events
            // notice we use the selectionmodel's rowselect event rather
            // than a click event from the grid to provide key navigation
            // as well as mouse navigation
            var bookGridSm = this.getComponent('gridPanel').getSelectionModel();
            ('selectionchange', function(sm, rs) {
            if (rs.length) {
                var detailPanel = Ext.getCmp('detailPanel');
                bookTpl.overwrite(detailPanel.body, rs[0].data);
            }
        })
            bookGridSm.on('selectionchange', this.onRowSelect, this);
        },
        // add a method called onRowSelect
        // This matches the method signature as defined by the 'rowselect'
        // event defined in Ext.selection.RowModel
        onRowSelect: function(sm, rs) {
            // getComponent will retrieve itemId's or id's. Note that itemId's
            // are scoped locally to this instance of a component to avoid
            // conflicts with the ComponentManager
            if (rs.length) {
                var detailPanel = this.getComponent('detailPanel');
                detailPanel.updateDetail(rs[0].data);
            }

        }
    });
// do NOT wait until the DOM is ready to run this
}, false);


// Finally now that we've defined all of our classes we can instantiate
// an instance of the app and renderTo an existing div called 'binding-example'
// Note now that classes have encapsulated this behavior we can easily create
// an instance of this app to be used in many different contexts, you could
// easily place this application in an Ext.Window for example
Ext.onReady(function() {
    // create an instance of the app
    var bookApp = new App.BookMasterDetail({
        renderTo: 'binding-example'
    });
    // We can retrieve a reference to the data store
    // via the StoreManager by its storeId
    Ext.data.StoreManager.get('gridBookStore').load();
});



</script>






<?

}
function lisamplia($mktime){

echo $valor="<script type='text/javascript'>
        Ext.get(\"".$mktime."\").on('dblclick', function(){
            var w = Ext.getCmp('west-panel');
       	    var h = Ext.getCmp('tabpanelss');

	    h.collapsed ? h.expand() : h.collapse();
            w.collapsed ? w.expand() : w.collapse();
	   
        });
</script>";

//return $valor;
}



function tipsayuda($nombre,$texto,$tipo='vacio',$tamanio='250'){
$texto=ucwords(strtolower($texto));
if($tipo=='listado')
$title='Ampliar tabla';
else if($tipo=='info')
$title='Informaci&oacute;n:';
else if($tipo=='modi')
$title='Modificar:';
else if($tipo=='nuevo')
$title='Nuevo Registro:';
else if($tipo=='buscador')
$title='Busqueda por filtros:';
else if($tipo=='ver')
$title='Ver datos:';
else if($tipo=='calen')
$title='Calendario: '.date('d-m-Y');
else if($tipo=='pdf')
$title='Impresi&oacute;n PDF:';
else if($tipo=='borrar')
$title='Borrar Datos:';
else if($tipo=='estatus')
$title='Cambiar Estatus:';
else
$title="Ayuda en campo: $nombre";

$valor="<script type='text/javascript'>
Ext.require([
    'Ext.tip.*'
]);

Ext.onReady(function() {

    var tooltips = [{
            target: '$nombre',
            title: '$title',
            width: $tamanio,
            html: '$texto',
            trackMouse: true
        }];
        
    Ext.each(tooltips, function(config) {
        Ext.create('Ext.tip.ToolTip', config);
    });  
	//Ext.Msg.alert('Failure', 'Failed to load locale file.');
    Ext.QuickTips.init();

});
</script>";


echo $valor;
}








function validarsession($dats=null) {
$ventana=date('assisahiss');
$titulo='SESION CERRADA';
$divlistado='vista';

$div=$dats.'datosdevalidaciondelsistema';


$tipo='guardar';

//$animation=1;
//if($animation==1)$animation="animateTarget: '".$div."',"; else$animation="animateTarget: 'title_tabs_1',";



$titulo=$this->For->mayus('',$titulo);
$div2=$div.'_2';
$valor="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";


$valor.="

<style type='text/css'>
.userx {
 background-image:url(img/login/user_comment.png);
}
.cross {
    background-image:url(img/iconos/icons/cross.gif);

}
.accept {
    background-image:url(img/iconos/icons/accept.png);
}

</style>

<script type='text/javascript'>


Ext.onReady(function() {
      var $ventana ,
      $ventana=Ext.create('Ext.window.Window', {
			id : 'vx$ventana',
			title: '$titulo',
      layout: 'fit',
			width: '450',
			height: '250',
			minWidth: '450',
			minHeight: '250',
			maxWidth: '450',
			maxHeight: '250',
	    layoutManagedWidth:2,
    	contentEl: '$div2',
      //   maximizable: true,
	    iconCls: 'userx',
    	animateTarget: 'msjsessioncerrada',
      //  collapsed: true,
      //  collapsible: true,
      //	constrain: true,
	    modal: true,
      //	autoScroll: true,
   	  closable: false,
	    //closeAction: 'win',
		  hideLabel: true,
     //		floatable: true,
	   //	bodyStyle: 'padding: 5px;background-color:#FFFFFF;',
 		 items: []

";

if($tipo=='guardar'){
$valor.="

,
 	    buttons: [{
	             text: 'Cancelar',
					     iconCls: 'cross',
               handler: function() {
               $ventana.hide();
	             $ventana=null;
			         //  this.up('$ventana').hide();
                    }
                },{

                    text: 'Entrar',
		                iconCls: 'accept',
                    handler: function() {
										EnviaFormulario('actulissszassacee','/Tp/relogeo/vx$ventana','$dats');
                    //    this.up('window').hide();
	
                    }
                    
                }]
";
}




$valor.="
 });
$ventana.show();

});


</script>";

$valor.="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";
$valor.='<META HTTP-EQUIV=Refresh CONTENT="0; URL=/Login">';
echo $valor;
}



function colorear2($busq,$cadena){

if(isset($busq) and $busq!='' and $busq!=null){
$cadena=str_replace('<input type="text" readonly="true" value="','',$cadena);
$cadena=str_replace('" style="border:0;background-color:transparent;" />','',$cadena);
}
 $nombrex= str_replace(strtolower($busq),'<font id="resf1'.date('is').'" color="#FF0000" style="background-color:#D9E7F8;"><b>'.ucwords($busq).'</b></font>',strtolower($cadena));
 $nombrex=strtr(strtoupper($nombrex),"àèìòùáéíóúçñäëïöü","ÀÈÌÒÙÁÉÍÓÚÇÑÄËÏÖÜ");



//$nombrex='<input type="text" value="'.$cadena.'" style="border:0;background-color:transparent;" />';


 return $nombrex;
}



function paginador_inicio() {
/*
$valor="<style type='text/css'>
        body .x-panel {
            margin-bottom:20px;
        }
        .icon-grid {
            background-image:url(../shared/icons/fam/grid.png) !important;
        }
        .add {
            background-image:url(../shared/icons/fam/add.gif) !important;
        }
        .option {
            background-image:url(../shared/icons/fam/plugin.gif) !important;
        }
        .remove {
            background-image:url(../shared/icons/fam/delete.gif) !important;
        }
        .save {
            background-image:url(../shared/icons/save.gif) !important;
        }
    </style>
";
*/

$mktime=mktime(date('his'));
$valor="<script type='text/javascript'>

Ext.require([
  'Ext.ux.data.PagingMemoryProxy',
  'Ext.ux.ProgressBarPager'
//  'Ext.ux.SlidingPager'
]);

Ext.onReady(function(){
    
    var myData".$mktime." = [ ";
echo $valor;

}



function paginador_fin($pag=20,$data= array(),$paginador=1,$numeracion=1) {


$titulos = array();

for($i=0;$i<count($data);$i++){

//echo '<br />'.$data[$i];
//$tr[] = array('id'=>'b','title'=>'NOMBRES Y APELLIDOS','width'=>'auto');
if(!isset($data[$i][1]))$data[$i][1]='auto';

if(isset($data[$i][2]) and $data[$i][2]=='c')$data[$i][2]='center';
else if(isset($data[$i][2]) and $data[$i][2]=='r')$data[$i][2]='right';
else $data[$i][2]='left';
//else if(isset($data[$i][2]) and $data[$i][2]=='l')$data[$i][2]='left';
//
$titulos[] = array('id'=>'x'.$i,'title'=>$data[$i][0],'width'=>$data[$i][1],'align'=>$data[$i][2]);

$accios='OPCIONES';
}




$cantpag=$pag;
$mktime=mktime(date('his'));

$valor="
    ];
		";
$valor.="
    // example of custom renderer function
    function change(val){
        if(val > 0){
            return '<span style=\"color:green;\">' + val + '</span>';
        }else if(val < 0){
            return '<span style=\"color:red;\">' + val + '</span>';
        }
        return val;
    }

    // example of custom renderer function
    function pctChange(val){
        if(val > 0){
            return '<span style=\"color:green;\">' + val + '%</span>';
        }else if(val < 0){
            return '<span style=\"color:red;\">' + val + '%</span>';
        }
        return val;
    }

    // register model
    Ext.define('Company', {
        extend: 'Ext.data.Model',
        idProperty: 'company',
        fields: [
";

 for($i=0; $i<count($titulos); $i++){ 
$valor.="
		 {name: '".$titulos[$i]["id"]."'},";
 } 



$valor.="
        ]  
      
    });
    ";

$valor.="
    // create the data store
    var store = Ext.create('Ext.data.Store', {
        model: 'Company',
        remoteSort: true,
        pageSize: ".$cantpag.",
        proxy: {

            type: 'pagingmemory',

            data: myData".$mktime.",
            reader: {
                type: 'array'
            }
        }
    });
    
    // create the Grid
    var grid".$mktime." = Ext.create('Ext.grid.Panel', {
      //  title:'Progress Bar Pager',
				border: 0,
        store: store,
   //     columnLines: true,

        columns: [
";

	if($numeracion===1){
				$valor.="
				      	        {xtype:'rownumberer',
							text: '#',
							width: 35,
						//	locked   : true,
						 },";
	}





 for($i=0; $i<count($titulos); $i++){ 
$id=str_replace(' ','',$titulos[$i]['title']);
$id=str_replace('%','',$id);$id=str_replace('"','',$id);$id=str_replace('?','',$id);$id=str_replace('¿','',$id);$id=str_replace('#','',$id);$id=str_replace('°','',$id);
$id=str_replace('.','',$id);$id=str_replace(',','',$id);$id=str_replace(';','',$id);$id=str_replace(':','',$id);$id=str_replace('|','',$id);$id=str_replace('$','',$id);
$id=str_replace('á','',$id);$id=str_replace('é','',$id);$id=str_replace('í','',$id);$id=str_replace('ó','',$id);$id=str_replace('ú','',$id);$id=str_replace('ñ','',$id);
$id=str_replace('Á','',$id);$id=str_replace('É','',$id);$id=str_replace('Í','',$id);$id=str_replace('Ó','',$id);$id=str_replace('Ú','',$id);$id=str_replace('Ñ','',$id);

$valor.="
             {
			";

							 if($titulos[$i]["title"]=='#'){
						$valor.="		locked   : true,";
							 }

		if(isset($titulos[$i]["align"])){
			$valor.="	align: '".$titulos[$i]["align"]."',";
		}

	$valor.="
	    //    tdAttrs: { valign: 'top' },	
	//	header: 'Price',



                text: '".$titulos[$i]["title"]."',
					";
									
								 if($titulos[$i]["title"]==$accios){ 
							  $valor.="	sortable: false,//xtype:'button',";
                 }else{
								$valor.=" sortable: true, ";
								 }


          $valor.="      
                dataIndex: '".$titulos[$i]['id']."', ";
							  if(!isset($titulos[$i]["width"]) or $titulos[$i]["width"]=='auto'){
					$valor.=" flex: 1";
                 }else{
					$valor.="width: ".$titulos[$i]['width'].",";
								}

$valor.="            },           ";



}

$valor.="
				],
        stripeRows: true,
        height:'100%',
        width:'100%',
        frame:false,
        //resizable: {
        //   handles: 's',
        //   minHeight: 100
        //},
";

	if($paginador===1){
	$valor.="
        bbar: Ext.create('Ext.PagingToolbar', {
            pageSize: ".$cantpag.",
            store: store,
            displayInfo: true,

						displayMsg: '{0}&nbsp;-&nbsp;{1}&nbsp;de&nbsp;{2}&nbsp;Usuarios',
            plugins: Ext.create('Ext.ux.ProgressBarPager', {})
				//		plugins: Ext.create('Ext.ux.SlidingPager', {})
        })
    
";
       }
$valor.="
});
    grid".$mktime.".render('mitabladiv".$mktime."');

    store.load();
});
</script>
<div id='mitabladiv".$mktime."'></div>



";



echo $valor;

}
/*
function leermas2($d='',$z=0,$cant=25){

$canf=strlen($d);
$cans=($cant-1);
				
if($canf>$cant){
return $valor="
<div id='".$z."_datosadicionales' style='display:none; float:left;'>".mb_substr($d,0,$canf)."
<font size='1px' color='#CCCCCC' onclick=\"leermas('0','$z');\">  ...ocultar</font>
<br /><br />
</div>
<div id='".$z."_leermasx' style='float:left;'>".mb_substr($d,0,$cant)."
<font size='1px' color='#CCCCCC'  onclick=\"leermas('1','$z');\">  ...leer</font>
</div>
";

}

}
*/

function paginador_td($busq,$data) {

$valor="";
$tyn = array();

$valor.="[";
for($i=0;$i<count($data);$i++){

//if(!isset($data[$i][1]))$data[$i][1]='auto';

$tyn[$i] =$data[$i] ;//$this->colorear2($busq,$data[$i]);
/*
echo '<pre>';
print_r($tyn[$i]);
echo '</pre>';
*/

if(count($tyn[$i])==1)
{
		for($z=0;$z<count($tyn[$i]);$z++){

						if($tyn[$i][$z]==='estatus_1'){
						$i_act= $this->For->img("iconos/icons/add.png",null,null,15,15);
						$valor.="'".$i_act."',";
						}
						else if($tyn[$i][$z]==='estatus_0'){
						$i_inc= $this->For->img("iconos/icons/delete.gif",null,null,15,15);
						$valor.="'".$i_inc."',";
						}
						else if($tyn[$i][$z]==='activo'){
						$i_inc= $this->For->img("iconos/icons/_tick.png",null,null,15,15);
						$valor.="'".$i_inc."',";
						}
						else if($tyn[$i][$z]==='inactivo'){
						$i_inc= $this->For->img("iconos/icons/cross.gif",null,null,15,15);
						$valor.="'".$i_inc."',";
						}
						else if($tyn[$i][$z]==='masculino'){
						$i_inc= $this->For->img("iconos/icons/user.png",null,null,15,15);
						$valor.="'".$i_inc."',";
						}
						else if($tyn[$i][$z]==='femenino'){
						$i_inc= $this->For->img("iconos/icons/user_female.png",null,null,15,15);
						$valor.="'".$i_inc."',";
						}



						else{
						$vads=explode('_ayudax_',$tyn[$i][$z]);
						if(isset($vads[1]))
						{
						$tyn[$i][$z]=str_replace('_ayudax_','',$tyn[$i][$z]);
						$valor.="'".$tyn[$i][$z]."',";
						}						
						else
						$valor.="'".$this->colorear2($busq,$tyn[$i][$z])."',";
						}
		}
}
else
{
$valor.="'";
		for($z=1;$z<count($tyn[$i]);$z++){


						if(count($tyn[$i])==($z+1)){


						$vads=explode('_ayudax_',$tyn[$i][$z]);
						if(isset($vads[1]))
						{
						$tyn[$i][$z]=str_replace('_ayudax_','',$tyn[$i][$z]);
						$valor.=" ".$tyn[$i][$z]."',";
						}						
						else
						$valor.=" ".$tyn[$i][$z]."'";
						}else
						{

						$valor.=" ".$tyn[$i][$z]."";
						}



		}	

}






}

$valor.="],";
	
echo $valor;
}

/**
Esta funcion debe ser migrada a ForHelper
Ejemplo $this->Json->windowopen('tucontroller/funcion','rutaimagen','950','600');
esta permite hacer un window.open javascritp
$ruta=
$img=
$width= tamaño en width de la ventana por defecto esta en 900px
$height= tamaño en height de la ventana por defecto esta en 600px
**/
function windowopen($ruta,$img,$width=900,$height=600) {
$valor="<a href=\"$ruta\" onClick=\"window.open(this.href,\"\",\"width=$width,height=$height\"); return false;\" style=\"text-decoration:none;\">".$img."</a>";

return $valor;
}





/**
Esta funcion crea una ventana json "POR CULMINAR DOCUMENTACION"
$ayuda= ya no se usa y debe ser eliminado lo antes posible
$divlistado= donde hace el llamado
$div= importante este va como nombre del div y del div_2 y debe esta en la vista
$titulo= titulo de la ventana
$url= controlador y vista a donde va el formulario 
$formulario= nombre del formulario a llamar
$tipo= monta botones de guardar y cerrar debo documentar


$animation= animacion de la ventana pero depende de siempre tener el id del div
$width= tamaño en width de la ventana por defecto esta en 80%
$height= tamaño en height de la ventana por defecto esta en 80%
**/
function iframe($ayuda='vacio',$divlistado='vista',$div=null,$titulo='',$url=null,$formulario=null,$tipo=null,$animation=0,$width='80%',$height='80%') {

if($animation==1)$animation="animateTarget: '".$div."',"; else$animation="animateTarget: 'title_tabs_1',";

$titulo=$this->For->mayus('',$titulo);
$div2=$div.'_2';
$valor="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";


$valor.="

<style type='text/css'>
.grid {

    background-image:url(img/iconos/icons/grid.png);
}
.folder_wrench {
    background-image:url(img/iconos/icons/folder_wrench.png);
}

.pdf {

    background-image:url(img/iconos/icons/pdf.png);
}
._page_word {
    background-image:url(img/iconos/icons/_page_word.png);


}
.gogle_palena {
    background-image:url(img/iconos/icons/gogle_palena.png);
}
.book {


    background-image:url(img/iconos/icons/book.png);
}
.cross {
    background-image:url(img/iconos/icons/cross.gif);

}
.accept {
    background-image:url(img/iconos/icons/accept.png);
}



</style>


<script type='text/javascript'>

Ext.onReady(function() {
    var ventana ,
    ventana=Ext.create('Ext.window.Window', {

				title: '$titulo <span id=\'title_filset_ventna\'></span>',
        layout: 'fit',
        width: '$width',
        height: '$height',



        minWidth: '30%',
	minHeight: '40%',
	layoutManagedWidth:2,
    	contentEl: '$div2',
      maximizable: true,

	iconCls: '_page_word',
	".$animation."
	constrain: true,
	modal: true,
	autoScroll: false,


     

/*  
	toggle:true,
        frame: true,

	resizable: true,

*/
    	   closable: true,
	//closeAction: 'win',

		hideLabel: true,
		floatable: true,
		bodyStyle: 'padding: 0px;background-color:#FFFFFF;',

 		items: []

";
$valor.="

    });

ventana.show();

});

</script>";

$valor.="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";


echo $valor;
}





function upload($titulo='SUBIR ARCHIVO',$campoimagen=null,$permitidos=array()){

$nop=array('php','ctp','html','htm');
for($j=0;$j<count($nop);$j++)
{
	if(in_array($nop[$j],$permitidos))
	{
		$indice= array_search($nop[$j],$permitidos);
		$permitidos[$indice]="INGDA_INGJC";
	}
}

$permitidos=serialize($permitidos);




$formu=mktime(date("his"));

$animation=0;
if($animation==1)$animation="animateTarget: '".$div."',"; else$animation="animateTarget: 'title_tabs_1',";
$div='vista';
$titulo=$titulo;
$div2=$div.$formu.'_2';
$valor="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";
$valor.="
<style type='text/css'>
.table_refresh {
    background-image:url(img/iconos/icons/table_refresh.png);
}
</style>

<script type='text/javascript'>
Ext.onReady(function() {
    var ventana$formu ,
    ventana$formu=Ext.create('Ext.window.Window', {
				id:'vent$formu',
				title: '$titulo',
        layout: 'fit',
        width: '515',
        height: '120',
			  minWidth: '515',
			  minHeight: '120',
			  maxWidth: '515',
			  maxHeight: '120',
	      layoutManagedWidth:2,
      	contentEl: '$div2',
        maximizable: false,

	iconCls: 'table_refresh',
	".$animation."
	constrain: true,
	modal: true,
	autoScroll: false,
   closable: true,
	//closeAction: 'win',

		hideLabel: true,
		floatable: true,
		bodyStyle: 'background-color:#D9E7F8;'

";
$valor.="

    });

ventana$formu.show();

});

</script>";

$valor.="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";

$valor.="<div id='".$div2."' style='display:none;' class='x-hide-display'>";

$valor.="<script type='text/javascript'>

/*
Ext.require([
    'Ext.form.field.File',
    'Ext.form.Panel',
    'Ext.window.MessageBox'
]);
*/
Ext.onReady(function(){

    var msg = function(title, msg) {
        Ext.Msg.show({
            title: title,
            msg: msg,
            minWidth: 250,
            modal: true,
            icon: Ext.Msg.INFO,
            buttons: Ext.Msg.OK
        });
    };

    Ext.create('Ext.form.Panel', {
        renderTo: 'fi-form$formu',
        width: 500,
				border: 0,
				id: 'for$formu',
        frame: false,
       // title: 'File Upload Form',
        bodyPadding: '10 10 10 10',
				bodyStyle: 'padding: 5px;background-color:#D9E7F8;',

        defaults: {
            anchor: '100%',
            allowBlank: false,
            msgTarget: 'side',
            labelWidth: 50
        },

        items: [/*{
            xtype: 'textfield',
            fieldLabel: 'Name'
        },*/{
            xtype: 'filefield',
             id: 'form-file$formu',
            emptyText: 'Seleccione un archivo',
					//	contentEl: 'zxcvbnm',
            fieldLabel: 'Archivo',
				  	//hideLabel: true,
            name: 'photo-path',
					//	align: 'center',
           buttonText: 'Buscar',
           buttonConfig: {
                iconCls: 'upload-icon'
            }
						



        }



],


        buttons: [{
            text: 'Subir',
						iconCls: '_inbox_upload',
            handler: function(){
                var form = this.up('form').getForm();


                if(form.isValid()){
                    form.submit({
                        url: 'file-upload.php?validate=12344321333&tipo=$permitidos',

                        waitMsg: 'Subiendo Archivo...',

                        success: function(fp, o) {
                            msg(o.result.tipo, '' + o.result.file + '');
														document.getElementById('$campoimagen').value=o.result.archivo;

		 										var h = Ext.getCmp('form-file$formu');
												h.show ? h.hide() : h.hide();
												h = null;
		 
												var h = Ext.getCmp('for$formu');
												h.show ? h.hide() : h.hide();
												h = null;

		 										var h = Ext.getCmp('vent$formu');
												h.show ? h.hide() : h.hide();
												h = null;

                      
												 }

                    });


                }
            }
        },{
            text: 'Reset',
						iconCls: 'cross',

            handler: function() {
                this.up('form').getForm().reset();
            }
        }]
    });

});

</script>
    <style type='text/css'>
        .upload-icon {
            background: url('../shared/icons/fam/image_add.png') no-repeat 0 0 !important;
        }
				._inbox_upload {
								    background: url('../shared/icons/fam/_inbox_upload.png') no-repeat 0 0 !important;
				}
				.cross {
								    background: url('../shared/icons/fam/cross.gif') no-repeat 0 0 !important;
				}
        #fi-button-msg {
            border: 2px solid #ccc;
            padding: 5px 10px;
            background: #eee;
            margin: 5px;
            float: right;
        }
    </style>
    <div id='fi-form$formu'></div>";
echo $valor;

}





function redirectsistema($titulo='',$animation=0,$width='80%',$height='80%') {

$divlistado='vista';$div='vista';

if($animation==1)$animation="animateTarget: '".$div."',"; else$animation="animateTarget: 'title_tabs_1',";

$titulo=$this->For->mayus('',$titulo);
$div2=$div.'_2';
$valor="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";


$valor.="

<style type='text/css'>
.grid {

    background-image:url(img/iconos/icons/grid.png);
}
.folder_wrench {
    background-image:url(img/iconos/icons/folder_wrench.png);
}

.gogle {
    background-image:url(img/iconos/icons/gogle.png);
}
.plugin_add {
    background-image:url(img/iconos/icons/plugin_add.png);

}
.gogle_palena {
    background-image:url(img/iconos/icons/gogle_palena.png);
}
.book {

    background-image:url(img/iconos/icons/book.png);
}
.cross {
    background-image:url(img/iconos/icons/cross.gif);
}
.accept {
    background-image:url(img/iconos/icons/accept.png);
}



</style>

<script type='text/javascript'>

Ext.onReady(function() {
    var ventana ,
    ventana=Ext.create('Ext.window.Window', {
//        id : 'mensaje',
				title: '$titulo <span id=\'title_filset_ventna\'></span>',
        layout: 'fit',
//	layout: 'border',
  //      width: '80%',
  //      height: '80%',
        width: '$width',
        height: '$height',


        minWidth: '30%',
	minHeight: '40%',
	layoutManagedWidth:2,
    	contentEl: '$div2',
      maximizable: false,
	iconCls: 'grid',
	".$animation."
//	animateTarget: 'menu0',
//  collapsed: true,
//  collapsible: true,
	constrain: true,
	modal: true,
	autoScroll: true,

     

/*  
	toggle:true,
        frame: true,
	resizable: true,

*/
    	   closable: false,
	//closeAction: 'win',
		hideLabel: true,
		floatable: true,
		bodyStyle: 'padding: 5px;background-color:#FFFFFF;',

 		items: [/*{
                    region: 'west',
                    title: 'Menu de Opciones',
                    width: 200,
                    split: true,
                    floatable: false,
		    contentEl: 'vista'
                }*/]

";



$valor.="

    });
ventana.show();

});

</script>";

$valor.="<script type='text/javascript'>
if(document.getElementById('$div2')!=null)
document.getElementById('$div2').style.display='block';
</script>";


echo $valor;
}
}
?>
